package dao.hibernate;

import java.util.List;

import model.*;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import dao.*;

public class HibernateDownloadFileDao extends HibernateDaoSupport implements DownloadFileDao {

    public DownloadFile getById(Long id) {
        return (DownloadFile) getHibernateTemplate().get(DownloadFile.class, id);
    }

    public void save(DownloadFile downfile) {
        getHibernateTemplate().saveOrUpdate(downfile);
    }
 
    @SuppressWarnings({"unchecked"})
    public List<DownloadFile> getAll() {
        return getHibernateTemplate().find("from DownloadFile");
    }
    
    public void delete(Long id){
    	Object a = getHibernateTemplate().load(DownloadFile.class, id);
    	this.getHibernateTemplate().delete(a);  
    }
}